<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
<!--    <meta name="viewport" content="width=device-width, initial-scale=1">-->
    <title>Восстановление пароля</title>
    <div th:replace="~{fragments/headTag :: headTag}"></div>
</head>
<body>
<!--@thymesVar id="emailAction" type="ru.tbcarus.spendingsb.model.EmailAction"-->
<!--@thymesVar id="err" type="ru.tbcarus.spendingsb.model.ErrorType"-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.1/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-HwwvtgBNo3bZJJLYd8oVXjrBZt8cqVSpeBNS5n7C8IVInixGAoxmnlMuBnhbgrkm"
        crossorigin="anonymous"></script>
<nav th:replace="~{fragments/loginBodyHeader :: loginBodyHeader}"></nav>
<div class="jumbotron pt-4 p-5 bg-light">
    <div class="container">
        <div class="d-flex justify-content-center">
            <div class="p-2">
                <div th:if="${err == null}" class="d-flex justify-content-center">
                    <form th:method="post" th:action="@{/register/reset-password}"
                          style="width: 300px">
                        <input hidden th:value="${emailAction.user.email}" th:name="email">
                        <input hidden th:value="${emailAction.code}" th:name="code">
                        <div class="form-group mb-4">
                            <label for="password">Введите новый пароль:</label>
                            <input type="password" th:name="password" id="password">
                        </div>
                        <div class="form-group mb-4">
                            <label for="passwordReply">Повторите новый пароль:</label>
                            <input type="password" th:name="passwordReply" id="passwordReply">
                        </div>
                        <div class="form-group mb-4">
                            <button class="btn btn-lg btn-primary" type="submit">Сменить пароль</button>
                        </div>
                    </form>
                </div>
                <div th:if="${err != null}">
                    <div class="alert alert-danger m-0" th:text="${err.title}">QWERTY</div>
                    <div class="d-flex justify-content-center p-2" th:if="${resendRequest}">
                        <form th:method="post" th:action="@{/register/password-reset-request}">
                            <input hidden="hidden" type="text" th:value="${param.email}" th:name="email">
                            <input hidden="hidden" type="text" th:value="${param.code}" th:name="code">
                            <button class="btn btn-lg btn-primary" type="submit">Повторить запрос</button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<!--    copyright-->
<div th:replace="~{fragments/footer :: copy}"></div>
</body>
</html>